<?php

namespace Emoney\EpayBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

use Emoney\EpayBundle\Form\Type\ContactType;


class IndexController extends Controller
{
    
    public function indexAction()
    {
        return $this->render('EmoneyEpayBundle:Index:index.html.twig');
    }

	/*
	*
	*/
	public function choisirLangueAction($langue = null)
	{
		if($langue != null)
		{
			// On enregistre la langue en session
			$this->container->get('session')->setLocale($langue);
		}
		// on tente de rediriger vers la page d'origine
		$url = $this->container->get('request')->headers->get('referer');
		if(empty($url)) {
			$url = $this->container->get('router')->generate('EmoneyEpayBundle_homepage');
		}
		return new RedirectResponse($url);
	}
	
    public function testserviceAction()
    {
	  echo "l'execution passe par ici. voici le resultat";
        $server = new \SoapServer('http://localhost/epay/web/hello.wsdl');
        $server->setObject($this->get('hello_service'));

        $response = new Response();
        $response->headers->set('Content-Type', 'text/xml; charset=ISO-8859-1');

        ob_start();
        $server->handle();
        //$response->setContent(ob_get_clean());

        return $response;
    }
	

}
